<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>其他变更</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="migration74.removed-extensions.html">« 移除的扩展</a></li>
      <li style="float: right;"><a href="migration74.windows-support.html">Windows 支持 »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="migration74.html">从 PHP 7.3.x 移植到 PHP 7.4.x</a></li>
    <li>其他变更</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="migration74.other-changes" class="sect1">
 <h2 class="title">其他变更</h2>

 <div class="sect2" id="migration74.other-changes.performance">
  <h3 class="title">性能提升</h3>

  <div class="sect3" id="migration74.other-changes.performance.core">
   <h4 class="title">PHP 核心</h4>
   <p class="para">
    为 <span class="function"><a href="function.array-key-exists.html" class="function">array_key_exists()</a></span> 函数添加了一个专门的 VM opcache
    优化，如果该函数可以被静态解析，则可以提高该函数的性能。如果你在项目中使用了命名空间，可能会需要使用
    <code class="literal">\array_key_exists()</code> 来显性的导入该函数。
   </p>
  </div>

  <div class="sect3" id="migration74.other-changes.performance.pcre">
   <h4 class="title">正则表达式 (Perl-Compatible)</h4>
   <p class="para">
    When <span class="function"><a href="function.preg-match.html" class="function">preg_match()</a></span> in UTF-8 mode (<code class="literal">&quot;u&quot;</code> modifier)
    is repeatedly called on the same string (but possibly different offsets),
    it will only be checked for UTF-8 validity once.
   </p>
  </div>
 </div>

 <div class="sect2" id="migration74.other-changes.ini">
  <h3 class="title">INI 配置文件处理的变化</h3>
  <p class="para">
   <a href="ini.core.html#ini.zend.exception-ignore-args" class="link">zend.exception_ignore_args</a> is a new INI directive
   for including or excluding arguments from stack traces generated
   from exceptions.
  </p>
  <p class="para">
   <a href="opcache.configuration.html#ini.opcache.preload-user" class="link">opcache.preload_user</a> is a new INI directive
   for specifying the user account under which preloading
   code is execute if it would otherwise be run as root (which is not
   allowed for security reasons).
  </p>
 </div>

 <div class="sect2" id="migration74.other-changes.pkg-config">
  <h3 class="title">迁移到 pkg-config</h3>
  <p class="para">
   一些扩展已经迁移到只使用 pkg-config 来检测库的依赖性。一般来说，这意味着不再用
   <strong class="option configure">--with-foo-dir=DIR</strong> 或类似的参数，而是使用
   <strong class="option configure">--with-foo</strong>。自定义库的路径可以通过向 <code class="literal">PKG_CONFIG_PATH</code>
   添加额外的目录，或通过 <code class="literal">FOO_CFLAGS</code> 和 <code class="literal">FOO_LIBS</code>
   来明确指定。
  </p>
  <p class="para">
    以下扩展和 SAPI 会受到影响：
  </p>

  <ul class="itemizedlist">
   <li class="listitem">
    <span class="simpara">CURL:</span>
    <ul class="itemizedlist">
     <li class="listitem">
      <span class="simpara">
       <strong class="option configure">--with-curl</strong> 选项不再接受一个目录。
      </span>
     </li>
    </ul>
   </li>

   <li class="listitem">
    <span class="simpara">Enchant:</span>
    <ul class="itemizedlist">
     <li class="listitem">
      <span class="simpara">
       <strong class="option configure">--with-enchant</strong> 选项不再接受一个目录。
      </span>
     </li>
    </ul>
   </li>

   <li class="listitem">
    <span class="simpara">FPM:</span>
    <ul class="itemizedlist">
     <li class="listitem">
      <span class="simpara">
       <strong class="option configure">--with-fpm-systemd</strong> now uses only pkg-config
       for libsystem checks. The libsystemd minimum required version is 209.
      </span>
     </li>
    </ul>
   </li>

   <li class="listitem">
    <span class="simpara">GD:</span>
    <ul class="itemizedlist">
     <li class="listitem">
      <span class="simpara">
       <strong class="option configure">--with-gd</strong> 改变为
       <strong class="option configure">--enable-gd</strong>
       (whether to enable the extension at all) 和
       <strong class="option configure">--with-external-gd</strong>
       (to opt into using an external libgd, rather than the bundled one).
      </span>
     </li>
     <li class="listitem">
      <span class="simpara">
       <strong class="option configure">--with-png-dir</strong> 参数被移除。需要 libpng 支持。
      </span>
     </li>
     <li class="listitem">
      <span class="simpara">
       <strong class="option configure">--with-zlib-dir</strong> 参数被移除。需要 zlib 支持。
      </span>
     </li>
     <li class="listitem">
      <span class="simpara">
       <strong class="option configure">--with-freetype-dir</strong>
       改变为 <strong class="option configure">--with-freetype</strong>
      </span>
     </li>
     <li class="listitem">
      <span class="simpara">
       <strong class="option configure">--with-jpeg-dir</strong> 改变为
       <strong class="option configure">--with-jpeg</strong>
      </span>
     </li>
     <li class="listitem">
      <span class="simpara">
       <strong class="option configure">--with-webp-dir</strong> 改变为
       <strong class="option configure">--with-webp</strong>
      </span>
     </li>
     <li class="listitem">
      <span class="simpara">
       <strong class="option configure">--with-xpm-dir</strong> 改变为
       <strong class="option configure">--with-xpm</strong>
      </span>
     </li>
    </ul>
   </li>

   <li class="listitem">
    <span class="simpara">IMAP:</span>
    <ul class="itemizedlist">
     <li class="listitem">
      <span class="simpara">
       <strong class="option configure">--with-kerberos-systemd</strong> 选项不再接受一个目录。
      </span>
     </li>
    </ul>
   </li>

   <li class="listitem">
    <span class="simpara">Intl:</span>
    <ul class="itemizedlist">
     <li class="listitem">
      <span class="simpara">
       <strong class="option configure">--with-icu-dir</strong>
       被移除。如果使用了 <strong class="option configure">--enable-intl</strong>
       参数，需要 libicu 支持。
      </span>
     </li>
    </ul>
   </li>

   <li class="listitem">
    <span class="simpara">LDAP:</span>
    <ul class="itemizedlist">
     <li class="listitem">
      <span class="simpara">
       <strong class="option configure">--with-ldap-sasl</strong> 选项不再接受一个目录。
      </span>
     </li>
    </ul>
   </li>

   <li class="listitem">
    <span class="simpara">Libxml:</span>
    <ul class="itemizedlist">
     <li class="listitem">
      <span class="simpara">
       <strong class="option configure">--with-libxml-dir</strong> 被移除。
      </span>
     </li>
     <li class="listitem">
      <span class="simpara">
       <strong class="option configure">--enable-libxml</strong> 改变为
       <strong class="option configure">--with-libxml</strong>。
      </span>
     </li>
     <li class="listitem">
      <span class="simpara">
       <strong class="option configure">--with-libexpat-dir</strong> 被重命名为
       <strong class="option configure">--with-expat</strong> 并且该选项不再接受一个目录。
      </span>
     </li>
    </ul>
   </li>

   <li class="listitem">
    <span class="simpara">Litespeed:</span>
    <ul class="itemizedlist">
     <li class="listitem">
      <span class="simpara">
       <strong class="option configure">--with-litespeed</strong> 改变为
       <strong class="option configure">--enable-litespeed</strong>。
      </span>
     </li>
    </ul>
   </li>

   <li class="listitem">
    <span class="simpara">Mbstring:</span>
    <ul class="itemizedlist">
     <li class="listitem">
      <span class="simpara">
       <strong class="option configure">--with-onig</strong> 被移除。如果指定了
       <strong class="option configure">--disable-mbregex</strong> 参数，则需要 libonig 支持。
      </span>
     </li>
    </ul>
   </li>

   <li class="listitem">
    <span class="simpara">ODBC:</span>
    <ul class="itemizedlist">
     <li class="listitem">
      <span class="simpara">
       <strong class="option configure">--with-iodbc</strong> 选项不再接受一个目录。
      </span>
     </li>
     <li class="listitem">
      <span class="simpara">
       <strong class="option configure">--with-unixODBC</strong> without a directory now uses
       pkg-config (preferred). Directory is still accepted for old versions without libodbc.pc.
      </span>
     </li>
    </ul>
   </li>

   <li class="listitem">
    <span class="simpara">OpenSSL:</span>
    <ul class="itemizedlist">
     <li class="listitem">
      <span class="simpara">
       <strong class="option configure">--with-openssl</strong> 选项不再接受一个目录。
      </span>
     </li>
    </ul>
   </li>

   <li class="listitem">
    <span class="simpara">PCRE:</span>
    <ul class="itemizedlist">
     <li class="listitem">
      <span class="simpara">
       <strong class="option configure">--with-pcre-regex</strong>
       被移除。Instead <strong class="option configure">--with-external-pcre</strong>
       is provided to opt into using an external PCRE library, rather
       than the bundled one.
      </span>
     </li>
    </ul>
   </li>

   <li class="listitem">
    <span class="simpara">PDO_SQLite:</span>
    <ul class="itemizedlist">
     <li class="listitem">
      <span class="simpara">
       <strong class="option configure">--with-pdo-sqlite</strong> 选项不再接受一个目录。
      </span>
     </li>
    </ul>
   </li>

   <li class="listitem">
    <span class="simpara">Readline:</span>
    <ul class="itemizedlist">
     <li class="listitem">
      <span class="simpara">
       <strong class="option configure">--with-libedit</strong> 选项不再接受一个目录。
      </span>
     </li>
    </ul>
   </li>

   <li class="listitem">
    <span class="simpara">Sodium:</span>
    <ul class="itemizedlist">
     <li class="listitem">
      <span class="simpara">
       <strong class="option configure">--with-sodium</strong> 选项不再接受一个目录。
      </span>
     </li>
    </ul>
   </li>

   <li class="listitem">
    <span class="simpara">SQLite3:</span>
    <ul class="itemizedlist">
     <li class="listitem">
      <span class="simpara">
       <strong class="option configure">--with-sqlite3</strong> 选项不再接受一个目录。
      </span>
     </li>
    </ul>
   </li>

   <li class="listitem">
    <span class="simpara">XSL:</span>
    <ul class="itemizedlist">
     <li class="listitem">
      <span class="simpara">
       <strong class="option configure">--with-xsl</strong> 选项不再接受一个目录。
      </span>
     </li>
    </ul>
   </li>

   <li class="listitem">
    <span class="simpara">Zip:</span>
    <ul class="itemizedlist">
     <li class="listitem">
      <span class="simpara">
       <strong class="option configure">--with-libzip</strong> 被移除。
      </span>
     </li>
     <li class="listitem">
      <span class="simpara">
       <strong class="option configure">--enable-zip</strong> 改变为
       <strong class="option configure">--with-zip</strong>。
      </span>
     </li>
    </ul>
   </li>

  </ul>
 </div>

 <div class="sect2" id="migration74.other-changes.csv">
  <h3 class="title">CSV 转义</h3>
  <p class="para">
   现在 <span class="function"><a href="function.fputcsv.html" class="function">fputcsv()</a></span>、<span class="function"><a href="function.fgetcsv.html" class="function">fgetcsv()</a></span>、<span class="methodname"><a href="splfileobject.fputcsv.html" class="methodname">SplFileObject::fputcsv()</a></span>、<span class="methodname"><a href="splfileobject.fgetcsv.html" class="methodname">SplFileObject::fgetcsv()</a></span>
   和 <span class="methodname"><a href="splfileobject.setcsvcontrol.html" class="methodname">SplFileObject::setCsvControl()</a></span> 的 <code class="literal">$escape</code> 参数 接受空字符，这会禁用 PHP 专有的转义机制。
  </p>
  <p class="para">
   <span class="function"><a href="function.str-getcsv.html" class="function">str_getcsv()</a></span> 的行为已相应调整（之前空字符串与使用默认值相同）。
  </p>
  <p class="para">
   <span class="methodname"><a href="splfileobject.getcsvcontrol.html" class="methodname">SplFileObject::getCsvControl()</a></span> 也可以相应的为第三个数组元素返回空字符串。
  </p>
 </div>

 <div class="sect2" id="migration74.other-changes.filter">
  <h3 class="title">数据过滤</h3>
  <p class="para">
   The <a href="book.filter.html" class="link">filter</a> extension no longer exposes
   <strong class="option configure">--with-pcre-dir</strong> for Unix builds and can now reliably
   be built as shared when using <strong class="command">./configure</strong>
  </p>
 </div>

 <div class="sect2" id="migration74.other-changes.gd">
  <h3 class="title">GD</h3>
  <p class="para">
   The behavior of <span class="function"><a href="function.imagecropauto.html" class="function">imagecropauto()</a></span> in the bundled
   libgd has been synced with that of system libgd:
  </p>
  <ul class="itemizedlist">
   <li class="listitem">
    <span class="simpara">
     <strong><code>IMG_CROP_DEFAULT</code></strong> is no longer falling
     back to <strong><code>IMG_CROP_SIDES</code></strong>
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     Threshold-cropping now uses the algorithm of system libgd
    </span>
   </li>
  </ul>
  <p class="para">
   The default <code class="literal">$mode</code> parameter of
   <span class="function"><a href="function.imagecropauto.html" class="function">imagecropauto()</a></span> has been changed to
   <strong><code>IMG_CROP_DEFAULT</code></strong>; passing <code class="literal">-1</code>
   is now deprecated.
  </p>
  <p class="para">
   <span class="function"><a href="function.imagescale.html" class="function">imagescale()</a></span> now supports aspect ratio preserving
   scaling to a fixed height by passing <code class="literal">-1</code>
   as <code class="literal">$new_width</code>.
  </p>
 </div>

 <div class="sect2" id="migration74.other-changes.hash">
  <h3 class="title">HASH Message Digest Framework</h3>
  <p class="para">
   The <a href="book.hash.html" class="link">hash</a> extension cannot be disabled
   anymore and is always an integral part of any PHP build, similar to
   the <a href="book.datetime.html" class="link">date</a> extension.
  </p>
 </div>

 <div class="sect2" id="migration74.other-changes.intl">
  <h3 class="title">Intl</h3>
  <p class="para">
   The <a href="book.intl.html" class="link">intl</a> extension
   now requires at least ICU 50.1.
  </p>
  <p class="para">
   <span class="classname"><a href="class.resourcebundle.html" class="classname">ResourceBundle</a></span> now implements
   <span class="interfacename"><a href="class.countable.html" class="interfacename">Countable</a></span>.
  </p>
 </div>

 <div class="sect2" id="migration74.other-changes.ldap">
  <h3 class="title">轻量级目录访问协议</h3>
  <p class="para">
   移除对 nsldap 和 umich_ldap 的支持。
  </p>
 </div>

 <div class="sect2" id="migration74.other-changes.libxml">
  <h3 class="title">Libxml</h3>
  <p class="para">
   All libxml-based extensions now require libxml 2.7.6 or newer.
  </p>
 </div>

 <div class="sect2" id="migration74.other-changes.mbstring">
  <h3 class="title">Multibyte String</h3>
  <p class="para">
   The oniguruma library is no longer bundled with PHP, instead libonig needs
   to be available on the system. Alternatively
   <strong class="option configure">--disable-mbregex</strong> can be used to disable
   the mbregex component.
  </p>
 </div>

 <div class="sect2" id="migration74.other-changes.opcache">
  <h3 class="title">OPcache</h3>
  <p class="para">
   The <strong class="option configure">--disable-opcache-file</strong> and
   <strong class="option configure">--enable-opcache-file</strong> configure options
   have been removed in favor of the
   <a href="opcache.configuration.html#ini.opcache.file-cache" class="link">opcache.file_cache</a> INI directive.
  </p>
 </div>

 <div class="sect2" id="migration74.other-changes.password">
  <h3 class="title">密码散列</h3>
  <p class="para">
   现在 <span class="function"><a href="function.password-hash.html" class="function">password_hash()</a></span> 和 <span class="function"><a href="function.password-needs-rehash.html" class="function">password_needs_rehash()</a></span>
   函数接受可以为 null 的字符串和 int 作为 <code class="literal">$algo</code> 参数。
  </p>
 </div>

 <div class="sect2" id="migration74.other-changes.pear">
  <h3 class="title">PEAR</h3>
  <p class="para">
   Installation of PEAR (including PECL) is no longer enabled by default. It
   can be explicitly enabled using <strong class="option configure">--with-pear</strong>.
   This option is deprecated and may be removed in the future.
  </p>
 </div>

 <div class="sect2" id="migration74.other-changes.reflection">
  <h3 class="title">Reflection</h3>
  <p class="para">
   The numeric values of the modifier constants
   (<code class="literal">IS_ABSTRACT</code>,
   <code class="literal">IS_DEPRECATED</code>,
   <code class="literal">IS_EXPLICIT_ABSTRACT</code>,
   <code class="literal">IS_FINAL</code>,
   <code class="literal">IS_IMPLICIT_ABSTRACT</code>,
   <code class="literal">IS_PRIVATE</code>,
   <code class="literal">IS_PROTECTED</code>,
   <code class="literal">IS_PUBLIC</code>, and
   <code class="literal">IS_STATIC</code>) on the
   <span class="classname"><a href="class.reflectionclass.html" class="classname">ReflectionClass</a></span>,
   <span class="classname"><a href="class.reflectionfunction.html" class="classname">ReflectionFunction</a></span>,
   <span class="classname"><a href="class.reflectionmethod.html" class="classname">ReflectionMethod</a></span>,
   <span class="classname"><a href="class.reflectionobject.html" class="classname">ReflectionObject</a></span>, and
   <span class="classname"><a href="class.reflectionproperty.html" class="classname">ReflectionProperty</a></span>
   classes have changed.
  </p>
 </div>

 <div class="sect2" id="migration74.other-changes.simplexml">
  <h3 class="title">SimpleXML</h3>
  <p class="para">
   <span class="classname"><a href="class.simplexmlelement.html" class="classname">SimpleXMLElement</a></span> now implements
   <span class="interfacename"><a href="class.countable.html" class="interfacename">Countable</a></span>.
  </p>
 </div>

 <div class="sect2" id="migration74.other-changes.sqlite3">
  <h3 class="title">SQLite3</h3>
  <p class="para">
   The bundled libsqlite has been removed. To build the
   <a href="book.sqlite3.html" class="link">SQLite3</a> extension a
   system libsqlite3 ≥ 3.7.4 is now required. To build the
   <a href="ref.pdo-sqlite.html" class="link">PDO_SQLite</a> extension
   a system libsqlite3 ≥ 3.5.0 is now required.
  </p>
  <p class="para">
   Serialization and unserialization of <span class="classname"><a href="class.sqlite3.html" class="classname">SQLite3</a></span>,
   <span class="classname"><a href="class.sqlite3stmt.html" class="classname">SQLite3Stmt</a></span> and <span class="classname"><a href="class.sqlite3result.html" class="classname">SQLite3Result</a></span>
   is now explicitly forbidden. Formerly, serialization of instances of
   these classes was possible, but unserialization yielded unusable objects.
  </p>
  <p class="para">
   The <code class="literal">@param</code> notation can now also be used to
   denote SQL query parameters.
  </p>
 </div>

 <div class="sect2" id="migration74.other-changes.zip">
  <h3 class="title">Zip</h3>
  <p class="para">
   The bundled libzip library has been removed.
   A system libzip &gt;= 0.11 is now necessary to build the
   <a href="book.zip.html" class="link">zip</a> extension.
  </p>
 </div>

</div></div></div></body></html>